from django.db import models
from django.contrib.auth.models import User
from django.db.models.fields import Field
from django.db.models.signals import post_save
# Create your models here.

class UserProfile (models.Model) :
	user = models.OneToOneField(User)

	#relevantInterests = []
	#savedSession = []
	JOB_POSITION_CHOICE = ( ('M', 'Manager') , ('E' , 'Engineer') )
	address = {'Line 1' : models.CharField(max_length=30),'Line 2' : models.CharField(max_length=30),'Town' : models.CharField(max_length=30),'County' : models.CharField(max_length=30)}
	company = models.CharField(max_length=30)
	companyPosition = models.CharField(max_length = 1, choices = JOB_POSITION_CHOICE)

	def __str__ (self) : 
		return "%s's Profile" % self.user

def create_user_profile(sender, instance, created, **kwargs) :
	if created: 
		profile, created = UserProfile.objects.get_or_create(user=instance)

post_save.connect(create_user_profile, sender = User)


"""
class GroupProfile (models.Model) : 
	group = models.ForeignKey(Groups, unique=True)
	
	def __unicode__ (self) : 
		return self.group
"""
	
	
